home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / SCROLVB.ZIP / SCROLL-2.TXT < prev    next >
Text File  |  1994-02-01  |  6KB  |  128 lines

  1.  
  2. > Program: SCROLL-2 - Visual Basic Demo Code
  3.  
  4. > Written By: Paul T. Dawson, P.O. Box 682, Chincoteague, VA, 23336
  5.  
  6. > Summary: VB 2.0 or 3.0 sample code that demonstrates "form scrolling".
  7.   No VBX controls required. No API calls required. No cost (free!).
  8.  
  9. > Requirements: To run the SCROLL-2.EXE file - Windows 3.1 and VBRUN200.DLL.
  10.   To use the sample code - Visual Basic 2.0 or higher.
  11.  
  12. > Limitation: This program will not display properly under Windows 3.0.
  13.  
  14. > Design Goals:
  15.  
  16.   1. Make a resizable form, with scroll bars to move around a large area.
  17.   2. Use the minimum amount of code.
  18.   3. Use default values wherever possible.
  19.   4. Add lots of comments!
  20.  
  21. > File List:
  22.  
  23.   SCROLL-2.TXT - This File (no margins or page breaks).
  24.   SCROLL-2.MAK - Visual Basic Project.
  25.   SCROLL-2.FRM - Visual Basic Form (MDI main form).
  26.   SCROLL-X.FRM - Visual Basic Form (MDI child form).
  27.   SCROLL-2.FRX - Visual Basic Graphics (just one little icon).
  28.   SCROLL-2.EXE - Finished EXE file.
  29.  
  30. > Design Summary:
  31.  
  32.   This program uses a MDI form as the main form. It has one "MDI child" form,
  33.   which is the "container" for all of the controls. Since the ScrollBars
  34.   property of the main form is True, Visual Basic automatically handles all
  35.   of the scroll bar positioning. The user can resize and/or scroll, and
  36.   without any extra code, VB moves everything around perfectly!
  37.  
  38.   The Child form has no caption bar, so it looks exactly like an empty
  39.   picture box. It can be many times larger than the screen, and any control
  40.   can be placed anywhere on it.
  41.  
  42.   After setting all of the various properties at design time, the program is
  43.   activated with ONE LINE of code:
  44.  
  45.      frmScroll.show
  46.  
  47.   After that line, VB does everything else in the scrolling department!
  48.  
  49. > Details About Objects:
  50.  
  51.   1. frmMain:
  52.      The main form is a MDI (Multiple Document Interface) form.
  53.      Everything on the form is default, except the caption and the
  54.      ScrollBars property (true).
  55.  
  56.   2. frmScroll:
  57.      This is the scrolling form, and it can be any size, up to about 32,000
  58.      pixels square. The MinButton, MaxButton, and ControlBox properties are
  59.      all set to False. Also, the BorderStyle is 0 (none), and when the
  60.      program runs, the Caption is set to "" (null), and then the form will
  61.      have NO title bar. It will just be one plain empty box!
  62.  
  63.      Also, the MDIChild property is set to True. This is critical!
  64.  
  65.      Setting those six properties correctly is the key to this program!!!
  66.  
  67.   3. picMenuBar:
  68.      This is on frmMain, and it has the default Align property of 1, which is
  69.      "Align Top". This means that it is "glued" to the top of the MDI form,
  70.      and it will stretch automatically when you resize it. This is the usual
  71.      place to put a bunch of menu buttons - in this sample program, there is
  72.      just one button.
  73.  
  74.      The picMenuBar control is not necessary for the form scrolling!
  75.      However, when you are scrolling a giant form around, it's convenient to
  76.      have something that is always visible - like picMenuBar.
  77.  
  78.   4. cmdExit:
  79.      This is the only control on picMenuBar. At design time, it's just a
  80.      random size, but when the program runs, it expands to fill all of
  81.      picMenuBar. Whenever you resize the main form, picMenuBar will always
  82.      automatically resize. Then Sub picMenuBar_Resize is called to fix the
  83.      size of cmdExit.
  84.  
  85.   5. cmdStart:
  86.      When you click this, everything starts to happen! This button was added
  87.      for the convenience of people without VB who just want to try the EXE
  88.      file. It just makes things more interesting to see all of the controls
  89.      before they are resized and duplicated.
  90.  
  91.   6. cmdHome(0 to 15):
  92.      These are some extra non-critical controls that I added to frmScroll, to
  93.      make the scrolling more visible. For a "real" program, these would all
  94.      be replaced with "real" controls that actually did something. Actually,
  95.      in this program, these buttons move the scrolling form back up to the
  96.      starting location in the upper left hand corner of frmMain.
  97.  
  98.      At design time, there is only one cmdHome button. Its Index property is
  99.      set to 0 (zero), and then at run time, 15 copies are created.
  100.  
  101. > Miscellaneous Notes:
  102.  
  103.   1. In this program, frmScroll is resized when the program runs. If you are
  104.      designing a scrolling form that's SMALLER than your screen, then it may
  105.      be easier to size it, and put all of the controls in the right places,
  106.      all at design time. You can't do that if the form will be LARGER than
  107.      your screen. If that's the case, you have to use code to resize the form
  108.      and move all of the controls to the right locations.
  109.  
  110.   2. Remember, any type of control can be placed onto the frmScroll form!!!
  111.  
  112.   3. With AutoRedraw=False, I have successfully tested this up to 32,000 by
  113.      32,000 pixels, the equivalent of 3,333 standard VGA screens. That's over
  114.      one BILLION pixels! When the size gets closer to 32,767, things start to
  115.      get flakey. VB won't make a form larger than that number, which is equal
  116.      to (2^15)-1.
  117.  
  118.      However, even though the form can be 32,767, I found that there were
  119.      problems positioning the controls at positions over 32,000. That's why I
  120.      suggest 32,000 as the maximum dimension.
  121.  
  122.      32,000 pixels by 32,000 pixels is over 800 square feet - all on one big
  123.      scrolling form.
  124.  
  125.   4. Please experiment on non-critical projects first!
  126.  
  127. /**** <End Of This File> - <10-29-93> - <P.T.D.> ****/
  128.